package com.carpedil.gateway.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/** @author Administrator */
@Configuration
public class SysConfig {
  @Bean
  public RouteLocator customRouteLocator(RouteLocatorBuilder routeLocatorBuilder) {
    RouteLocatorBuilder.Builder routes = routeLocatorBuilder.routes();

    routes.route("a", r -> r.path("/client/**").uri("lb://clientServer")).build();
    routes.route("b", r -> r.path("/order/**", "/order/").uri("lb://orderServer")).build();
    routes.route("c", r -> r.path("/movie/**").uri("lb://movieServer")).build();
    routes.route("c", r -> r.path("/auth/**").uri("lb://authServer")).build();
    return routes.build();
  }
}
